using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Saw : MonoBehaviour
{
    public float speed = 2.0f;
    public float moveTime = 3.0f;

    private bool _directionRight = true;
    private float _timer;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (_directionRight)
        {
            transform.Translate(Vector2.right * speed * Time.deltaTime);
        }
        else
        {
            transform.Translate(Vector2.left * speed * Time.deltaTime);
        }

        _timer += Time.deltaTime;
        if (_timer > moveTime)
        {
            _directionRight = !_directionRight;
            _timer = 0.0f;
        }
    }
}
